CUBE CONNECT Edition Help

Introduction to Generation program

The Generation program processes zonal data according to specified expressions, and generates arrays of productions and attractions for up to twenty purposes. There are no default processes; it is your responsibility to specify what is to be accomplished. Usually, you use the Generation program to produce trip end data files (productions and attractions) for use in a trip distribution model.

Generation is a direct application of Matrix. There are a few control statements and keywords in the Matrix control set that are not valid in a Generation application. It is the user’s responsibility to program the logic, computations, and output; very little is assumed by the program. However, the capability is nearly open-ended. There may be up to twenty trip purposes estimated in a single application.

The program processes within an overall origin zone loop controlled by the variable named I. To make things a little more meaningful to some users, I may alternatively be referenced as Z. (A companion variable Z is set to I every time I is changed internally; I and Z can not be revised by the user). The Generation program has two processing phases and stacks: the normal stack (ILOOP) that begins with the first stack statement, and an optional ADJUST stack, which begins with the statements following the PHASE=ADJUST statement. The I-loop processes only the normal stack statements; it does not proceed beyond the PHASE=ADJUST statement. The ADJUST stack is processed one time only – after the I-loop is completed. Its purpose is to provide capabilities to adjust and/or balance final production and attraction totals.

Productions and attractions are to be computed for each zone; they are referred to as P and A, respectively. There may be up to twenty Ps and twenty As for each zone. The computed Ps and As are stored into arrays and must be referenced with array notation. The arrays are doubly dimensioned. Only the first index (purpose) is required; the second index (zone) is optional. The zonal index will be set to I if it is not specified. There is very little need to use a JLOOP, but if one is used, it is suggested that P and A references within the JLOOP contain both indices. Any attempt to use an invalid index will result in a fatal message. The lower limit for each index is 0; the upper limits are MAXPURPS and ZONES. P[1]=ZI.1.POP indicates that the productions for purpose 1 for the current I zone are to be obtained from the ZDATI[1] array named POP. A more detailed expression would be P[1][I] = ZI.1.POP[I], but such detail is not necessary.

When the ILOOP phase is completed, the program fills in the [0] row and [0] columns for the P and A arrays; row and column 0 cells are set to the marginal values. The statements in the ADJUST stack can reference index [0] to obtain row and/or column totals. The COMP functions, PTOT(#) and ATOT(#) can also be used at any time to compute the totals for purpose #. There is a significant difference when referencing P and A in COMP statements in the ADJUST stack. In ILOOP, COMP P and A is processed for a single zone index (I); in ADJUST, a COMP P and A causes processing for all zones in that P or A. This is to simplify the final adjusting process. However, double indexing on the right side of the equal sign can set the process to compute for only that specific zone.

It should be noted that IF/ENDIF, LOOP/ENDLOOP, and JLOOP/ENDJOOP blocks and any GOTOs may not span a PHASE. The program will treat such conditions as errors.

Example

A[1] = 1 ; sets only 1 cell
P[1] = A[1] ; sets only 1 cell
/* Adjustment Phase — Set A[1] to total to P[1] total
Move A[1] to P[1] (maybe NHB)
fac = ptot(1) / atot(1) a[1]=fac * a[1] ; would be the same */
PHASE=ADJUST
A[1] = P[1][0] / A[1][0] * A[1]
P[1] = A[1]

The FILEO PAO keyword is used to write the computed P and A values to file records.